$(function () {
    var hidden = $('#hidden').val();
    $("#ask").click(function(){
        var order = $("#order").val();
        if(order === '' || order.length === 0){
            layer.msg('请输入订单号');
            return ;
        }
        $.ajax({
            url:"/storage/Bom/addBomFromK3",
            dataType:"json",
            type:'POST',
            data:{orderId:order,hidden:hidden},
            beforeSend:function () {
                $('.loading').show();
            }, complete:function(){
                $('.loading').hide();
            },success:function(res){
                console.log(res);
                if(res.success===true){
                    layer.msg(res.message);
                    //将开头写到前面
                    var str = /\w[A-z]+/.exec(order)[0];
                    $('#order').val(str);
                    $('#table').bootstrapTable('refresh');
                }else if(res.success === false){
                    layer.msg(res.message);
                }
            },error:function(){
                layer.msg('网络错误');
            }
        })
    });
});